//
//  NSTableView+reLoadData.swift
//  onemeetingmac
//
//  Created by 张衡 on 2020/6/8.
//  Copyright © 2020 onemeeting. All rights reserved.
//

import Foundation


extension NSTableView {
    func lreloadData() {
        let row = self.selectedRow
        self.reloadData()
        self.selectRowIndexes(NSIndexSet.init(index: row) as IndexSet, byExtendingSelection: false)
    }
    
    func reloadDataKeepingSelection() {
        let selectedRowIndexes = self.selectedRowIndexes
        self.reloadData()
        self.selectRowIndexes(selectedRowIndexes, byExtendingSelection: false)
    }
    
    func kreloadData() {
        self.beginUpdates()
        self.reloadData(forRowIndexes: self.selectedRowIndexes, columnIndexes: self.selectedColumnIndexes)
        self.reloadData()//Trying to avoid this func...
        self.selectRowIndexes(self.selectedRowIndexes, byExtendingSelection: true)
        self.endUpdates()
    }
}
